Skip to content

Comments

feat: add .git-ai-ignore file support for custom ignore patterns#573

Merged
svarlamov merged 2 commits intomainfrom
devin/1771709639-git-ai-ignore
Feb 21, 2026
Merged

feat: add .git-ai-ignore file support for custom ignore patterns#573
svarlamov merged 2 commits intomainfrom
devin/1771709639-git-ai-ignore

Conversation

@svarlamov
Copy link
Member

@svarlamov svarlamov commented Feb 21, 2026

feat: add .git-ai-ignore file support for custom ignore patterns

Summary

Adds support for a .git-ai-ignore file at the repository root, allowing users to specify additional file patterns to exclude from git-ai tracking. The file uses .gitignore-style syntax (one glob pattern per line, # comments, blank lines skipped).

Patterns from .git-ai-ignore are unioned with all existing ignore sources in effective_ignore_patterns():

  1. Built-in defaults (lockfiles, generated files, etc.)
  2. .gitattributes linguist-generated patterns
  3. .git-ai-ignore patterns ← new
  4. Extra patterns (programmatic)
  5. User CLI --ignore patterns

The implementation mirrors the existing .gitattributes loading: reads from workdir for normal repos, reads from HEAD for bare repos.

No callers were changed — all four call sites (checkpoint.rs, status.rs, post_commit.rs, git_ai_handlers.rs) go through effective_ignore_patterns(), so .git-ai-ignore is picked up automatically everywhere.

Review & Testing Checklist for Human

  • Verify the simplified parsing is acceptable: The parser strips leading/trailing whitespace via trim() and skips #-prefixed lines, but does NOT support .gitignore negation (!pattern), escaped hashes (\#), or directory-only trailing slashes (dir/). Confirm this subset is sufficient for the intended use case.
  • Confirm union ordering is correct: .git-ai-ignore patterns are inserted after .gitattributes linguist-generated and before extra/user patterns. Verify this doesn't cause unexpected precedence issues given that all patterns are additive (ignore-only, no un-ignore).
  • Test manually: Create a repo with a .git-ai-ignore containing a pattern like docs/**, make changes to files matching that pattern, run git-ai checkpoint and git-ai status --json, and confirm those files are excluded from stats.

Notes

  • The .git-ai-ignore file is read from the working directory (not the committed version) for non-bare repos, consistent with how .gitattributes is already handled. This means uncommitted .git-ai-ignore files take effect immediately.
  • All 19 unit tests and 8 integration tests pass locally.
  • Link to Devin run
  • Requested by: @svarlamov

Open with Devin

Add support for a .git-ai-ignore file at the repository root that allows
users to specify additional file patterns to ignore in git-ai tracking.
The file follows .gitignore syntax (one glob pattern per line, # comments,
blank lines skipped).

Patterns from .git-ai-ignore are unioned with:
- Default ignore patterns (lockfiles, generated files, etc.)
- Linguist-generated patterns from .gitattributes
- User-provided --ignore CLI patterns

Works for both regular and bare repositories (reads from HEAD for bare).

Includes unit tests for:
- Loading patterns from workdir and bare repos
- Comment/blank line handling
- Deduplication
- Missing file handling
- Union with gitattributes and user patterns

Includes integration tests for:
- Checkpoint filtering with .git-ai-ignore
- Status diff counting with .git-ai-ignore
- Union behavior with .gitattributes linguist-generated

Co-Authored-By: unknown <>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@svarlamov svarlamov merged commit 2d722eb into main Feb 21, 2026
27 of 28 checks passed
@svarlamov svarlamov deleted the devin/1771709639-git-ai-ignore branch February 21, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants